package com.esun.cheetah.view.personal.sportlotteryfootball;

import com.esun.util.log.EDebug;

import android.app.Activity;
import android.os.Handler;
import android.view.View;

/**
 * 
 * @Package com.esun.cheetah.view.personal.sportlotteryfootball.SportteryBuyLottery
 * @ClassName: SportteryBuyLottery
 * @Description: TODO(buy football lottery activity)
 * @author handy <br/>
 * @date create at 2012-7-31 下午2:51:08
 *
 */
public abstract class SportteryBuyLottery extends Activity {

	public static final String INFO = "info";
	public static final String IS_CHECKED = "is_checked";
	public static final String W = "w";
	public static final String D = "d";
	public static final String L = "l";
	public static final String IS_ACTIVE = "is_active";
	public static final String IS_DAN = "is_dan";
	public static final String TAG = "tag";
	public static final String TEAM_COUNT = "team_count";
	public static final String TYPE = "type";
	public static final String STR_TYPE = "str_type";

	public static final int LIMIT_DAN_COUNT = 7;

	public static final int BUY_SUCCEED = 11001;
	public static final int BUY_FAIL = 11002;

	public static final int TEXT_CHECKED_COLOR = 0xffff6000;
	public static final int TEXT_UNCHECKED_COLOR = 0xff675532;

	protected Handler handlerChooseList;// 界面的handler

	protected int limitDanNum; // 胆码个数限制

	/** 获取胆码个数上限 */
	public int getLimitDanNum() {
		return limitDanNum;
	}

	/** 设置胆码个数上限 */
	public void setLimitDanNum(int limitDanNum) {
		this.limitDanNum = limitDanNum;
	}

	protected void setHandler(Handler handler) {
		handlerChooseList = handler;
	}

	public abstract View getView();

	public abstract void setSportteryChooseListPage(
			SportteryChooseList chooseListPage);

	protected String strLengthOption(String str, int max) {
		EDebug.o(this, str + "==>" + str.length() + "==>" + max);
		String str_ = str.replaceAll("\\s", "");
		if (str_.length() < max + 1) {
			return str;
		} else {
			StringBuffer sb = new StringBuffer();
			sb.append(str.substring(0, max - 1)).append("...");
			String result = sb.toString();
			return result;
		}
	}
}
